<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>设备管理</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/layui.css" />
	<style>
		.layui-row {
			margin-top: 50px;
		}

		.offer {
			width: 90px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			font-size: 16px;
			border-radius: 4px;
		}

		.return {
			width: 80px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			margin-top: -35px;
			margin-left: 130px;
			font-size: 16px;
			border-radius: 4px;
		}
	</style>
</head>

<body>
	
	<div class="layui-row" id="vue-root">
		<div></div>
		<div class="layui-col-md6 layui-col-md-offset3">
			<div class="layui-form-item">
				<label class="layui-form-label">学校名称</label>
				<div class="layui-input-block">
					<select name="schoolName" v-validate="'required'" class="layui-input school"
						v-model="item.schoolId">
						<option :value="undefined">请选择学校</option>
						<option v-for="school in schools" :key="school.id" :value="school.id" v-text="school.name">
						</option>
					</select>
					<div class="checkout_state" v-text="err('schoolName')"></div>
				</div>

			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">设备位置</label>
				<div class="layui-input-block">
					<input name="deviceName" v-validate="'required'" autocomplete="off" placeholder="请输入考勤设备"
						class="layui-input name" v-model="item.name">
					<div class="checkout_state" v-text="err('deviceName')"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">设备编码</label>
				<div class="layui-input-block">
					<input name="deviceCode" v-validate="'required'" autocomplete="off" placeholder="请输入设备编码"
						class="layui-input tag" v-model="item.code">
					<div class="checkout_state" v-text="err('deviceCode')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<div class="offer" @click="submit">立即提交</div>
					<div class="return" onclick="history.back()">取消</div>
				</div>
			</div>
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	
	
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>

	<script>
		var app = new Vue(merge({
			data: {
				item: {
					schoolId: null,
					type: 1
				},
				url: '/pc/device',
				schools: [],
			},
			created: function () {
				var agentId = top_params().id;
				axios.get('/pc/school/all/' + agentId).then(function (res) {
					this.schools = res.data;
				}.bind(this));
				this.init();
			}
		}));

	</script>
</body>

</html>